import request from '@/utils/request'
import {
    InboundInvoiceItem,
    InboundInvoiceListRequest,
    InboundInvoiceRequest,
    InboundInvoiceSummaryListRequest
} from '@/interface/inbound_invoice'
import {AddRequest} from "@/interface/stockout";

//添加发票
export const InboundInvoiceAddR = (req: InboundInvoiceItem) => {
    req.date /= 1
    return request({
        method: 'POST',
        url: '/inbound_invoice',
        data: JSON.stringify(req),
    })
}

//删除发票
export const InboundInvoiceRemoveR = (req:InboundInvoiceRequest) => {
    return request({
        method: 'DELETE',
        url: `/inbound_invoice`,
        params: req
    })
}


//修改发票
export const InboundInvoiceUpdateR = (req: InboundInvoiceItem) => {
    req.date /= 1
    return request({
        method: 'PUT',
        url: '/inbound_invoice',
        data: JSON.stringify(req),
    })
}

//入库发票汇总
export const InboundInvoiceSummaryR = () => {
    return request({
        method: 'GET',
        url: '/inbound_invoice/summary'
    })
}

export const InboundInvoiceListR = (req: InboundInvoiceListRequest) => {
    return request({
        method: 'GET',
        url: '/inbound_invoice',
        params: req,
    })
}
export const InboundInvoiceSummaryListR = (req: InboundInvoiceSummaryListRequest) => {
    return request({
        method: 'GET',
        url: '/inbound_invoice/summarylist',
        params: req,
    })
}